<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >

  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/turbolinks/5.2.0/turbolinks.js" integrity="sha256-iM4Yzi/zLj/IshPWMC1IluRxTtRjMqjPGd97TZ9yYpU=" crossorigin="anonymous"></script>
  <link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Cousine|Inconsolata" rel="stylesheet">
  <link rel="shortcut icon" type="image/png" href="/favicon.png">

  <link rel="stylesheet" href="/css/style.css">
  <link rel="stylesheet" href="/css/css/fontawesome-all.min.css">
  <link rel="stylesheet" href="/css/css/work-sans-v7.css">
  <script src="/js/main.js"></script>

  <!-- Begin Jekyll SEO tag v2.6.1 -->
<title>Exchange Node | Hive Developer</title>
<meta name="generator" content="Jekyll v4.0.0" />
<meta property="og:title" content="Exchange Node" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Setting up a node for exchanges." />
<meta property="og:description" content="Setting up a node for exchanges." />
<link rel="canonical" href="exchange_node.html" />
<meta property="og:url" content="exchange_node.html" />
<meta property="og:site_name" content="Hive Developer" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-08-26T11:52:22-07:00" />
<script type="application/ld+json">
{"description":"Setting up a node for exchanges.","mainEntityOfPage":{"@type":"WebPage","@id":"exchange_node.html"},"@type":"BlogPosting","url":"exchange_node.html","headline":"Exchange Node","dateModified":"2020-08-26T11:52:22-07:00","datePublished":"2020-08-26T11:52:22-07:00","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->


  
</head>
<body>
<header>
  <h1>
    <button type="button" class="open-nav" id="open-nav"></button>
    <a href="/"  class="logo-link"><img src="/images/logotype_black.svg" height="40" alt="Hive Developer logo"></a>
  </h1>

  
  <form action="/search/" method="get">
    <input type="text" name="q" id="search-input" placeholder="Search">
    <input type="submit" value="Search" style="display: none;">
  </form>
  

  <div id="sidebar" class="sidebar">
	
	
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/">
		<h6 class="ctrl-nav-section title">Introduction</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/#introduction-welcome">Welcome to Hive</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/quickstart/">
		<h6 class="ctrl-nav-section title">Quickstart</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/quickstart/#quickstart-choose-library">Choose Library</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-hive-full-nodes">Hive Nodes</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-testnet">Hive Testnet</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/tutorials/">
		<h6 class="ctrl-nav-section title">Tutorials</h6>
		<ul class="cont-nav-section content">
			
				
					
						<li><a href="/tutorials/#tutorials-javascript">Javascript</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-python">Python</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-ruby">Ruby</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-recipes">Recipes</a></li>
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/services/">
		<h6 class="ctrl-nav-section title">Services</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/services/#services-hive-blog">hive.blog</a></li>
						
					
						
						<li><a href="/services/#services-hivesigner">HiveSigner</a></li>
						
					
						
						<li><a href="/services/#services-jussi">Jussi</a></li>
						
					
						
						<li><a href="/services/#services-imagehoster">ImageHoster</a></li>
						
					
						
						<li><a href="/services/#services-dhf">DHF</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/apidefinitions/">
		<h6 class="ctrl-nav-section title">Appbase API</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/apidefinitions/#apidefinitions-condenser-api">Condenser Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-bridge">Bridge</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-by-key-api">Account By Key Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-history-api">Account History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-block-api">Block Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-database-api">Database Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-debug-node-api">Debug Node Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-follow-api">Follow Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-jsonrpc">Jsonrpc</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-market-history-api">Market History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-network-broadcast-api">Network Broadcast Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-rc-api">Rc Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-reputation-api">Reputation Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-rewards-api">Rewards Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-tags-api">Tags Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-transaction-status-api">Transaction Status Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-witness-api">Witness Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops">Broadcast Ops</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops-communities">Broadcast Ops Communities</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/resources/">
		<h6 class="ctrl-nav-section title">Resources</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/resources/#resources-overview">Overview</a></li>
						
					
						
						<li><a href="/resources/#resources-client-libs">Client Libraries</a></li>
						
					
						
						<li><a href="/resources/#resources-bluepaper">Bluepaper</a></li>
						
					
						
						<li><a href="/resources/#resources-whitepaper">Whitepaper</a></li>
						
					
						
						<li><a href="/resources/#resources-tools">Tools</a></li>
						
					
						
						<li><a href="/resources/#resources-hivesigner-libs">Hivesigner Libs</a></li>
						
					
						
						<li><a href="/resources/#resources-hive-keychain">Hive Keychain</a></li>
						
					
						
						<li><a href="/resources/#resources-developeradvocate">Community & Help</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/glossary/">
		<h6 class="ctrl-nav-section title">Glossary</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/glossary/#glossary-chain-basics">Chain Basics</a></li>
						
					
						
					
						
						<li><a href="/glossary/#glossary-governance">Governance</a></li>
						
					
						
						<li><a href="/glossary/#glossary-transactions">Transactions</a></li>
						
					
						
						<li><a href="/glossary/#glossary-api">API</a></li>
						
					
						
						<li><a href="/glossary/#glossary-market">Market</a></li>
						
					
				
			
		</ul>
	</section>
	
</div>



  <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
</header>
<div class="main" id="top">
  <div class="hero">
    <h1 class="hero__h1">Hive Developer Portal </h1>
    <img class="hero__img" src="/images/honey-comb-92.png" style="position: relative; top: 10px;" />
  </div>
  <section id="tutorials-recipes-exchange-node" class="row tutorials-recipes-exchange-node">
	<h3>
		<a id="tutorials-recipes-exchange-node">
			Exchange Node
			
		</a>
	</h3>
	
		<span class="description"><p>Setting up a node for exchanges.</p>
</span>
	

	<h3 id="intro">Intro</h3>

<p>By defining a range of accounts to track as a JSON pair <code class="highlighter-rouge">["from", "to"]</code>, we can instruct <code class="highlighter-rouge">steemd</code> to only track the exact accounts that involve the exchange.</p>

<p>These instructions are similar to setting up a <a href="/tutorials-recipes/get_transaction_node.html">Get Transaction Node</a>, but requires far less time to sync because it is configured to focus on only the exchange account(s).</p>

<p>If you prefer a docker version of these instructions, please refer to:</p>

<p><a href="https://github.com/steemit/steem/blob/master/doc/exchangequickstart.md">exchangequickstart.md</a></p>

<h3 id="sections">Sections</h3>

<ul>
  <li><a href="#minimum-requirements">Minimum Requirements</a></li>
  <li><a href="#building-steemd">Building <code class="highlighter-rouge">steemd</code></a></li>
  <li><a href="#configure-node">Configure Node</a></li>
  <li><a href="#latest-block-log">Latest Block Log</a></li>
  <li><a href="#sync-node">Sync Node</a></li>
  <li><a href="#troubleshooting">Troubleshooting</a></li>
</ul>

<h3 id="minimum-requirements">Minimum Requirements</h3>

<p>This tutorial assumes Ubuntu Server 18.04 LTS 16GB RAM and 320GB SSD/HDD.</p>

<h3 id="building-steemd">Building <code class="highlighter-rouge">steemd</code></h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt-get update
<span class="nb">sudo </span>apt-get dist-upgrade
<span class="nb">sudo </span>apt-get <span class="nb">install </span>autoconf automake autotools-dev bsdmainutils <span class="se">\</span>
  build-essential cmake doxygen gdb libboost-all-dev libreadline-dev <span class="se">\</span>
  libssl-dev libtool liblz4-tool ncurses-dev pkg-config python3-dev <span class="se">\</span>
  python3-pip nginx fcgiwrap awscli gdb libgflags-dev libsnappy-dev zlib1g-dev <span class="se">\</span>
  libbz2-dev liblz4-dev libzstd-dev
<span class="nb">mkdir</span> <span class="nt">-p</span> ~/src
<span class="nb">cd</span> ~/src
git clone <span class="nt">--branch</span> stable https://github.com/steemit/steem.git
<span class="nb">cd </span>steem
git submodule update <span class="nt">--init</span> <span class="nt">--recursive</span>
<span class="nb">mkdir</span> <span class="nt">-p</span> build
<span class="nb">cd </span>build
cmake <span class="se">\</span>
  <span class="nt">-DCMAKE_BUILD_TYPE</span><span class="o">=</span>Release <span class="se">\</span>
  <span class="nt">-DLOW_MEMORY_NODE</span><span class="o">=</span>ON <span class="se">\</span>
  <span class="nt">-DCLEAR_VOTES</span><span class="o">=</span>ON <span class="se">\</span>
  <span class="nt">-DSKIP_BY_TX_ID</span><span class="o">=</span>OFF <span class="se">\</span>
  <span class="nt">-DSTEEM_LINT_LEVEL</span><span class="o">=</span>OFF <span class="se">\</span>
  <span class="nt">-DENABLE_MIRA</span><span class="o">=</span>OFF <span class="se">\</span>
  ..
make <span class="nt">-j</span><span class="si">$(</span><span class="nb">nproc</span><span class="si">)</span>
<span class="nb">sudo </span>make <span class="nb">install</span>
</code></pre></div></div>

<h3 id="configure-node">Configure Node</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">mkdir</span> <span class="nt">-p</span> ~/steem_data
<span class="nb">cd</span> ~/steem_data
steemd <span class="nt">--data-dir</span><span class="o">=</span><span class="nb">.</span>
</code></pre></div></div>

<p>At the startup banner, press <code class="highlighter-rouge">^C</code> (Ctrl+C) to exit <code class="highlighter-rouge">steemd</code>.  As a side effect, a default data-dir is created.  Now we can purge the empty blockchain and create <code class="highlighter-rouge">config.ini</code> as follows:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">rm</span> <span class="nt">-Rf</span> blockchain
nano config.ini
</code></pre></div></div>

<p>Then make the following changes to the generated <code class="highlighter-rouge">config.ini</code>:</p>

<ul>
  <li>Enable plugins: <code class="highlighter-rouge">p2p webserver account_history block_api condenser_api database_api account_history_api</code></li>
  <li>Whitelist only the exchange account(s).</li>
  <li>Pick a port for p2p to <code class="highlighter-rouge">2000</code>.</li>
  <li>Edit <code class="highlighter-rouge">shared-file-size</code> to <code class="highlighter-rouge">54G</code>.</li>
  <li>Pick a port for <code class="highlighter-rouge">webserver-http-endpoint</code> and set <code class="highlighter-rouge">webserver-ws-endpoint</code> to the next-highest port.</li>
</ul>

<p>To summarize, the <em>changed</em> values are:</p>

<div class="language-ini highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="py">plugin</span> <span class="p">=</span> <span class="s">p2p webserver account_history block_api condenser_api database_api account_history_api</span>
<span class="py">account-history-track-account-range</span> <span class="p">=</span> <span class="s">["nameofaccount", "nameofaccount"]</span>
<span class="py">shared-file-size</span> <span class="p">=</span> <span class="s">54G</span>
<span class="py">p2p-endpoint</span> <span class="p">=</span> <span class="s">0.0.0.0:2000</span>
<span class="py">webserver-http-endpoint</span> <span class="p">=</span> <span class="s">0.0.0.0:8751</span>
<span class="py">webserver-ws-endpoint</span> <span class="p">=</span> <span class="s">0.0.0.0:8752</span>
</code></pre></div></div>

<p>Note that <code class="highlighter-rouge">account-history-track-account-range</code> can be a range of accounts, or multiple ranges, if specified more than once (see: <a href="/tutorials-recipes/node-config.html#account-history-track-account-range"><code class="highlighter-rouge">account-history-track-account-range</code></a>).</p>

<p>Save <code class="highlighter-rouge">config.ini</code>.</p>

<h4 id="latest-block-log">Latest Block Log</h4>

<p>Download the block log (optional but recommended).</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd</span> ~/steem_data
<span class="nb">mkdir</span> <span class="nt">-p</span> blockchain
wget <span class="nt">-O</span> blockchain/block_log https://s3.amazonaws.com/steemit-dev-blockchainstate/block_log-latest
steemd <span class="nt">--data-dir</span><span class="o">=</span><span class="nb">.</span> <span class="nt">--replay-blockchain</span>
</code></pre></div></div>

<h3 id="sync-node">Sync Node</h3>

<p>If you did not download the latest block log:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd</span> ~/steem_data
steemd <span class="nt">--data-dir</span><span class="o">=</span><span class="nb">.</span> <span class="nt">--resync-blockchain</span>
</code></pre></div></div>

<p>After <em>replay</em> or <em>resync</em> is complete, the console will display <code class="highlighter-rouge">Got ## transactions from  ...</code>.  It’s possible to close <code class="highlighter-rouge">steemd</code> with <code class="highlighter-rouge">^C</code> (Ctrl+C).  Then, to start the node again:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd</span> ~/steem_data
steemd <span class="nt">--data-dir</span><span class="o">=</span><span class="nb">.</span>
</code></pre></div></div>

<h3 id="troubleshooting">Troubleshooting<a style="float: right" href="#sections"><i class="fas fa-chevron-up fa-sm"></i></a></h3>

<p><strong>Problem:</strong> Got an error while trying to compile <code class="highlighter-rouge">steemd</code>:</p>

<p><code class="highlighter-rouge">c++: internal compiler error: Killed (program cc1plus)</code></p>

<p><strong>Solution:</strong> Add more memory or enable swap.</p>

<p>To enable swap (do not enable swap on a VPS like Digital Ocean):</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo dd </span><span class="k">if</span><span class="o">=</span>/dev/zero <span class="nv">of</span><span class="o">=</span>/var/swap.img <span class="nv">bs</span><span class="o">=</span>1024k <span class="nv">count</span><span class="o">=</span>4000
<span class="nb">sudo chmod </span>600 /var/swap.img
<span class="nb">sudo </span>mkswap /var/swap.img
<span class="nb">sudo </span>swapon /var/swap.img
</code></pre></div></div>

<hr />

<p><strong>Problem:</strong> Got an error while replaying:</p>

<p><code class="highlighter-rouge">IO error: While open a file for appending: /root/steem_data/./blockchain/rocksdb_witness_object/012590.sst: Too many open files</code></p>

<p><strong>Solution:</strong> You’re using MIRA, but this tutorial recommends <em>not</em> to (<code class="highlighter-rouge">-DENABLE_MIRA=OFF</code>).  If you really <em>intend</em> to try MIRA, you will need to set higher limits.  Note, if you are also running <code class="highlighter-rouge">steemd</code> as <code class="highlighter-rouge">root</code> (not recommended), you must explicitly set hard/soft nofile/nproc lines for <code class="highlighter-rouge">root</code> instead of <code class="highlighter-rouge">*</code> in <code class="highlighter-rouge">/etc/security/limits.conf</code>.</p>

<p>To set the open file limit …</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>nano /etc/security/limits.conf
</code></pre></div></div>

<p>Add the following lines:</p>

<div class="language-conf highlighter-rouge"><div class="highlight"><pre class="highlight"><code>*      <span class="n">hard</span>    <span class="n">nofile</span>     <span class="m">94000</span>
*      <span class="n">soft</span>    <span class="n">nofile</span>     <span class="m">94000</span>
*      <span class="n">hard</span>    <span class="n">nproc</span>      <span class="m">64000</span>
*      <span class="n">soft</span>    <span class="n">nproc</span>      <span class="m">64000</span>
</code></pre></div></div>

<p>To set the <code class="highlighter-rouge">fs.file-max</code> limit …</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>nano /etc/sysctl.conf
</code></pre></div></div>

<p>Add the following line:</p>

<div class="language-ini highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="py">fs.file-max</span> <span class="p">=</span> <span class="s">2097152</span>
</code></pre></div></div>

<p>Load the new settings:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>sysctl <span class="nt">-p</span>
</code></pre></div></div>

<p>Once you save these files, you may need to logout and login again.</p>

</section>

</div>
<div class="footer">
  <a href="#">Back to top</a>
</div>
<script>
    document.getElementById("open-nav").addEventListener("click", function () {
        document.body.classList.toggle("nav-open");
    });
</script>
</body>
</html>


<script src="/js/adjust.js"></script>

